﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Com.Library.DB.Banner;

namespace Com.Web.coffinegurunaru.AppLogic
{
    public static class BannerExtenstion
    {
        public static string GetBannerGenerator(this BannerEntity Info, int width, int height)
        {
			string AnchorHeader = string.Empty;
			string Img = string.Empty;
			string AnchorTail = string.Empty;

			if (Info.Link != string.Empty)
			{
				AnchorHeader = "<a href=\"" + Info.Link + "\"" + (Info.LinkType == CodeLinkType.Blank ? " target=\"_bank\"" : "") + ">";
				AnchorTail = "</a>";
			}
			Img = "<img src=\"" + Info.ImageURL + "\" width=\"" + width.ToString() + "\" height=\"" + height + "\" />";

			return AnchorHeader + Img + AnchorTail;
        }
    }
}
